<template>
	<view class="page-content" >
		<u-sticky bgColor="#fff">
			<u-tabs :list="list" :is-scroll="false" :current="current" @change="change"></u-tabs>
		</u-sticky>

		<!-- 管理员 -->
		<template v-if="role === '0'">
			<asset-admin v-if="current === 0" :permissionData="permissionData"/>
			<bug-admin v-if="current === 1" :permissionData="permissionData"/>
			<compliance-admin v-if="current === 2" :permissionData="permissionData"/>
			<security-incidents-admin v-if="current === 3" :permissionData="permissionData"/>
			<security-audit-admin v-if="current === 4" :permissionData="permissionData"/>
		</template>
	</view>
</template>

<script>
	import $ from 'common/utils/jquery-3.5.1.min.js'
	import assetAdmin from "./components/admin/asset.vue"
	import bugAdmin from "./components/admin/bug.vue"
	import complianceAdmin from "./components/admin/compliance.vue"
	import securityIncidentsAdmin from "./components/admin/securityIncidents.vue"
	import securityAuditAdmin from "./components/admin/securityAudit.vue"
	export default {
		components: {
			assetAdmin,
			bugAdmin,
			complianceAdmin,
			securityIncidentsAdmin,
			securityAuditAdmin,
		},
		data() {
			return {
				list: [{
					name: '资产'
				}, {
					name: '漏洞'
				}, {
					name: '合规',
				}, {
					name: '安全事件',
				}, {
					name: '安全审计',
				}],
				current: 0,
				role: '0',
				permissionData:[],
				tableHeight: ''
			}
		},
		onLoad() {
			if (this.role == '0') {
				this.list = [{
					name: '资产'
				}, {
					name: '漏洞'
				}, {
					name: '合规',
				}, {
					name: '安全事件',
				}, {
					name: '安全审计',
				}]
			}
			// this.$nextTick(() => {
			// 	this.tableHeight=$(window).height() -35
			// 	this.watermark()
			// 	let userName=uni.getStorageSync('userName')
			// 	let phoneNumber=uni.getStorageSync('phoneNumber')
			// 	let time = this.$timeFormat(new Date(), 'yyyy年mm月dd日')
			// 	$('.uni-body').watermark({
			// 		texts : [userName+phoneNumber, time], //水印文字
			// 		textColor : "#DCDCDC", //文字颜色
			// 		textFont : '14px 微软雅黑', //字体
			// 		width : 200, //水印文字的水平间距
			// 		height : 150,  //水印文字的高度间距（低于文字高度会被替代）
			// 		textRotate : -20 //-90到0， 负数值，不包含-90
			// 	})
			// })
		},
		created () {
			document.title = "";
		   // this.getpermission()
		},
		methods: {
			change(index) {
				this.current = index;
			},
			// // 获取当前用户标签权限
			// async getpermission() {
			// 	let data = await this.$api.getpermission(); //已经封装好的api
			// 	if (data.Code == 200) {
			// 		// this.loading = false
			// 		this.permissionData=data.Data
			// 		console.log(this.permissionData,'permissionData888')
			// 	} else {
			// 		uni.showToast({
			// 			title: '请求失败!',
			// 			icon: 'none',
			// 			duration: 5000,
			// 			mask: true,
			// 		});
			// 	}
			// },
		}
	}
</script>

<style lang="scss" scoped>
	.u-sticky{
		width: 100% !important;
	}
	.page-content {
		
	}
</style>